package com.cac.demo.service.msWorkbinMaterial;


import com.cac.demo.dao.materialReceive.WmsItemInventoryDao;
import com.cac.demo.dao.msWorkbinMaterial.MsWorkbinMaterialDao;
import com.cac.demo.entity.msWorkbinMaterial.MsWorkbinMaterialDTO;


import com.cac.demo.util.adapter.DaoException;
import com.cac.demo.util.adapter.QueryReqBean;
import com.cac.demo.util.adapter.QueryRespBean;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @program test-curd
 * @description 缓存箱物料信息服务
 * @author: LSL
 * @create: 2022-09-01-11-16
 **/
@Service
public class MsWorkbinMaterialService {
    @Autowired
    private MsWorkbinMaterialDao msWorkbinMaterialDao;
    @Autowired
    private WmsItemInventoryDao wmsItemInventoryDao;



    //根据工作包编码查询缓存箱物料信息
    public QueryRespBean<MsWorkbinMaterialDTO> searchByPackage(QueryReqBean<MsWorkbinMaterialDTO> queryReqBean, String aoBarcode){
        QueryRespBean<MsWorkbinMaterialDTO> queryRespBean = new QueryRespBean<>();
        try{
            PageHelper.startPage(queryReqBean.getPageParameter());
            MsWorkbinMaterialDTO searchParams = queryReqBean.getSearchParams();
            Page<MsWorkbinMaterialDTO> dataList = msWorkbinMaterialDao.searchByAoCode(searchParams,aoBarcode);
            queryRespBean.setResult(dataList);
            return queryRespBean;
        }catch (Exception e){
            throw new DaoException(e.getMessage());
        }
    }
}
